package com.siyao.redvip.volley;

import java.io.File;
import java.util.Map;

import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.conn.DefaultClientConnection;

import android.content.Context;

import com.android.volley.AuthFailureError;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.Response.ErrorListener;
import com.android.volley.Response.Listener;
import com.android.volley.RetryPolicy;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.siyao.redvip.utils.Track;

public class NetRequest implements IReuest {

	private RequestQueue mQueue;

	private NStringRequest stringRequest;

	public NetRequest(Context arg0) {
		if (mQueue == null) {
			mQueue = Volley.newRequestQueue(arg0);
		}
	}

	public static String uploadFile(File file, Map<String, String> map,
			String uploadheadimgUrl) {
		
		
		return null;
	}

	public RetryPolicy getRetryPolicy() {
		return new DefaultRetryPolicy(20000, 1, 1.0F);
	}

	@Override
	public void doGetRequest(String url, Response.Listener<String> listener,
			Response.ErrorListener errorListener) {
		NStringRequest localk = new NStringRequest( Request.Method.GET,
				url, listener, errorListener);
		mQueue.add(localk);
		localk.setShouldCache(true);
	}

	@Override
	public void doPostRequest(String url, Map<String, String> paramMap,
			Response.Listener<String> listener,
			Response.ErrorListener errorListener) {
		
		NStringRequest localk = new NStringRequest(Request.Method.POST,
				url, listener, errorListener, paramMap);
		mQueue.add(localk);
	}

	
	/**
	 * 上传图片
	 */
	@Override
	public void addFileUpload(String param, File file) {
		
	}

}
